package com.sunlands.deskmate.enums;

/**
 * Created by yanliu on 2019/4/17.
 */
public enum MessageType {

    HEART_BEAT("800", "切换前后台运行"),

    PRIVATE_CHAT("100", "私聊"),
    GROUP_CHAT("200", "群聊"),
    ROOM_CHAT("300", "室聊"),

    ENTER_PRIVATE_CHAT("101", "进入私聊"),
    QUIT_PRIVATE_CHAT("102", "退出私聊"),
    SHARE_GROUP_TO_PRIVATE("103", "分享群到私聊"),
    SHARE_ROOM_TO_PRIVATE("104", "分享room到私聊"),
    SHARE_DIARY_TO_PRIVATE("105", "分享某个日记到私聊"),
    SHARE_DIARY_COMMENT_TO_PRIVATE("116", "分享某个日记评论到私聊"),

    ENTER_GROUP("201", "进入群聊"),
    QUIT_GROUP("202", "退出群聊"),
    group_user_join("加入群", "211"),
    group_user_exit("退出群", "212"),
    SHARE_GROUP_TO_GROUP("203", "分享群到群聊"),
    SHARE_ROOM_TO_GROUP("204", "分享房间到群聊"),
    SHARE_DIARY_TO_GROUP("205", "分享某个日记到群聊"),
    SHARE_DIARY_COMMENT_TO_GROUP("216", "分享某个日记评论到群聊"),

    ENTER_ROOM("301", "进入室聊"),
    QUIT_ROOM("302", "退出室聊"),
    SHARE_GROUP_TO_ROOM("303", "分享群到room聊"),
    SHARE_ROOM_TO_ROOM("304", "分享room到其它room聊"),
    SHARE_DIARY_TO_ROOM("305", "分享某个日记到room聊"),
    APPLY_PUBLISH("306", "申请上麦"),
    SHARE_DIARY_COMMENT_TO_ROOM("316", "分享某个日记评论到room聊"),
    CLOSE_ROOM("314", "关闭房间"),
    AgreeApplyPublish("308", "房主同意上麦"),
    QuitPublish("309", "下麦"),
    OperateAllMic("310", "全员禁麦操作"),
    HostChange("312", "切换房主"),

    VIP_TIME_SWITCH("350", "切换时长"),
    VIP_TIME_USE_UP("351", "全部时长用尽"),

    NO_AUTH("401", "没有权限"),
    ACK("501", "ACK消息"),

    USER_ONLINE("601","用户-用户上线"),
    USER_OFFLINE("602","用户-用户上线"),

    DYNAMIC_MESSAGE("700", "个人（你或TA）相关动态"),
    TARGET_SELECT_ME("708", "你选择了新的学习目标"),
    TARGET_SELECT_FRIEND("709", "TA选择了新的学习目标"),

    DYNAMIC_CREATE_ROOM("750", "动态创建房间"),
    DYNAMIC_CLOSE_ROOM("751", "动态关闭房间");

    private String type;
    private String name;

    MessageType(String type, String name) {
        this.type = type;
        this.name = name;
    }

    public String getType() {
        return type;
    }



    public String getName() {
        return name;
    }


    public static MessageType of(String type) {
        for (MessageType mt : MessageType.values()) {
            if(mt.getType().equals(type)){
                return mt;
            }
        }
        throw new NullPointerException("没有找到对应的消息类型 type = " + type);
    }
}
